function run(req, res){
    console.log('in register');
    var userBean = require('../been/user').userBean;
    var db = require('../db').db;
    var userModel = db.model('users',userBean);
    var params = {};
    var errors = {}
    var body = req.body;
    if(body.id){
        params['userId'] = body.id;
    }else{
        errors['id'] = '用户名不能为空';
    }
    if(body.pwd){
        params['pwd'] = body.pwd;
    }else{
        errors['pwd'] = '密码不能为空';
    }
    if(body.name){
        params['name'] = body.name;
    }else{
        errors['name'] = '昵称不能为空';
    }
    if(body.age){
        params['age'] = body.age;
    }else{
        errors['age'] = '用户名不能为空';
    }
    params['isDel'] = 0;
    params['male'] = body.male?body.male:2;
    params['create'] = new Date().getTime();
    params['update'] = new Date().getTime();
    // insert
    if(params['userId']){
        userModel.find({'userId':params['userId']},function(err,results){
            if(err){
                console.error(err);
                res.send(err);
            }else if(results.length > 0){
                res.send(JSON.stringify({err:'草，被注册了'}));
            }else{
                var userDB = new userModel(params);
                userDB.save(function(err){
                    if(err){
                        res.send(err);
                    }else{
                        res.send(JSON.stringify({}));
                    }
                });
            }
        });
    }
}
exports.run = run;